<?php
App::uses('AppModel', 'Model');
/**
 * Colaborador Model
 *
 * @property Pessoa $Pessoa
 * @property Cargo $Cargo
 * @property DisciplinaTurma $DisciplinaTurma
 * @property UnidadeEnsino $UnidadeEnsino
 */
class Colaborador extends AppModel {
    
        public $actsAs = array('Containable');

/**
 * Display field
 *
 * @var string
 */
	public $displayField = 'matricula';

/**
 * Validation rules
 *
 * @var array
 */
	public $validate = array(
		'matricula' => array(
			'notEmpty' => array(
				'rule' => array('notEmpty'),
				'message' => 'Preenchimento obrigatório.',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
			'maxLength' => array(
				'rule' => array('maxLength', 4),
				'message' => 'O campo só pode conter o máximo de 4 caracteres.',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'ctps' => array(
			'maxLength' => array(
				'rule' => array('maxLength', 20),
				'message' => 'O campo só pode conter o máximo de 20 caracteres.',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'serie_ctps' => array(
			'maxLength' => array(
				'rule' => array('maxLength', 10),
				'message' => 'O campo só pode conter o máximo de 10 caracteres.',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'pis' => array(
			'maxLength' => array(
				'rule' => array('maxLength', 15),
				'message' => 'O campo só pode conter o máximo de 15 caracteres.',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'ativo' => array(
			'notEmpty' => array(
				'rule' => array('notEmpty'),
				'message' => 'Preenchimento obrigatório.',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
	);

	//The Associations below have been created with all possible keys, those that are not needed can be removed

/**
 * belongsTo associations
 *
 * @var array
 */
	public $belongsTo = array(
		'Pessoa' => array(
			'className' => 'Pessoa',
			'foreignKey' => 'pessoa_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'Cargo' => array(
			'className' => 'Cargo',
			'foreignKey' => 'cargo_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);

/**
 * hasMany associations
 *
 * @var array
 */
	public $hasMany = array(
		'DisciplinaTurma' => array(
			'className' => 'DisciplinaTurma',
			'foreignKey' => 'colaborador_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);


/**
 * hasAndBelongsToMany associations
 *
 * @var array
 */
	public $hasAndBelongsToMany = array(
		'UnidadeEnsino' => array(
			'className' => 'UnidadeEnsino',
			'joinTable' => 'colaboradores_unidade_ensinos',
			'foreignKey' => 'colaborador_id',
			'associationForeignKey' => 'unidade_ensino_id',
			'unique' => 'keepExisting',
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'finderQuery' => '',
		)
	);

}
